@extends('backend::layout')

@section('title', __('New Account'))

@section('content')
    <form method="post" enctype="multipart/form-data">
        {{ csrf_field() }}
        <div class="box box-primary">
            <div class="box-header with-border">
                <div class="col-lg-4">
                    <h3 class="box-title">{{ __('New Account') }}</h3>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body pad-10">
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('name')) has-error @endif">
                        <label class="control-label">{{ __('Username') }}</label>
                        <input class="form-control" name="name" type="text" placeholder="{{ __('Username') }}" value="{{ old('name') }}">
                        @if($errors->has('name'))
                            <span class="help-block">{{ $errors->first('name') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('phone')) has-error @endif">
                        <label class="control-label">{{ __('Mobile') }}</label>
                        <input class="form-control" name="phone" type="text" placeholder="{{ __('Mobile') }}" value="{{ old('phone') }}">
                        @if($errors->has('phone'))
                            <span class="help-block">{{ $errors->first('phone') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('password')) has-error @endif">
                        <label class="control-label">{{ __('Password') }}</label>
                        <input class="form-control" name="password" type="password" placeholder="{{ __('Password') }}">
                        @if($errors->has('password'))
                            <span class="help-block">{{ $errors->first('password') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('password_confirmation')) has-error @endif">
                        <label class="control-label">{{ __('Confirm Password') }}</label>
                        <input class="form-control" name="password_confirmation" type="password" placeholder="{{ __('Confirm Password') }}">
                        @if($errors->has('password_confirmation'))
                            <span class="help-block">{{ $errors->first('password_confirmation') }}</span>
                        @endif
                    </div>
                </div>

                @if($isSchool)
                    <input type="hidden" name="agency_id" value="{{ $thisAgencyId }}"
                @else
                    <div class="col-lg-4">
                        <div class="form-group @if($errors->has('agency_id')) has-error @endif">
                            <label class="control-label">用户类型：</label>
                            <select class="form-control" name="agency_id">
                                <option value="">{{ __('-- Please Selected --') }}</option>
                                @if(!empty($agencies))
                                    @foreach($agencies as $item)
                                        <option value="{{ $item->id }}" @if(old('agency_id') == $item->id ) selected @endif>{{ $item->name }}</option>
                                    @endforeach
                                @endif
                            </select>
                            @if($errors->has('agency_id'))
                                <span class="help-block">{{ $errors->first('agency_id') }}</span>
                            @endif
                        </div>
                    </div>
                @endif
                <div class="col-lg-4">
                    <div class="form-group">
                        <label class="control-label">{{ __('Status') }}</label>
                        <div class="radio">
                            <label>
                                <input type="radio" value="1" @if(old('status') === null || old('status') == 1) checked @endif name="status">
                                {{ __('Open') }}
                            </label>
                        </div>
                        <div class="radio">
                            <label>
                                <input type="radio" value="0" @if(old('status') !== null && old('status') == 0) checked @endif name="status">
                                {{ __('Close') }}
                            </label>
                        </div>
                        @if($errors->has('status'))
                            <span class="help-block text-danger">{{ $errors->first('status') }}</span>
                        @endif
                    </div>
                </div>
            </div>
            <!-- /.box-body -->
            <div class="box-footer m-b-2">
                <div class="col-lg-4">
                    <button class="btn btn-primary btn-sm" type="submit">
                        <i class="fa fa-check"></i> {{ __('Save') }}
                    </button>
                    &nbsp;&nbsp;&nbsp;
                    <a class="btn btn-default btn-sm" href="javascript:history.back(-1);">
                        <i class="fa fa-undo"></i> {{ __('Back') }}
                    </a>
                </div>
            </div>
            <!-- /.box-footer -->
        </div>
    </form>
@stop